<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index()->comment('用户ID');
            $table->integer('media_id')->index()->comment('媒体ID');
            $table->string('title')->index()->comment('新闻标题');
            $table->string('describe')->comment('描述');
            $table->string('cover')->comment('封面');
            $table->text('content')->comment('详细内容');
            $table->tinyInteger('is_index')->comment('首页显示');
            $table->tinyInteger('is_hot')->comment('热门');
            $table->smallInteger('zan_num')->comment('赞数量');
            $table->integer('column_id')->index()->comment('所属栏目');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
